package com.cfh.web.admin;

import org.apache.log4j.Logger;

import java.util.Map;
import org.apache.struts2.interceptor.SessionAware;
import com.opensymphony.xwork2.ActionSupport;

public class LoginAction extends ActionSupport implements SessionAware {
	/**
	 * Logger for this class
	 */
	private static final Logger logger = Logger.getLogger(LoginAction.class);

	private static final long serialVersionUID = 1L;

	private Map session;

	public String execute() throws Exception {
		if (logger.isDebugEnabled()) {
			logger.debug("LoginAction execute() - start"); //$NON-NLS-1$
		}

		if (session.containsKey("currentUser")) {
			session.remove("currentUser");
			if (logger.isDebugEnabled()) {
				logger.debug(">>logout"); //$NON-NLS-1$
			}

		}

		if (logger.isDebugEnabled()) {
			logger.debug(" LoginAction execute() - end"); //$NON-NLS-1$
		}
		return SUCCESS;
	}

	public void setSession(Map session) {
		this.session = session;
	}

}
